<template>
  <div :style="{ ...coreStyle.marginSame(8) }">
    <a-card>
      <a-form ref="loginLogFormQueryRef" :model="loginLogFormQueryModel" labelAlign="left" layout="vertical" :style="{ ...coreStyle.marginBottom(10) }">
        <a-row :gutter="16" v-show="!loginLogFormQueryVisible">
          <a-col :span="8">
            <a-form-item :style="{ ...coreStyle.marginBottom(-8) }">
              <a-input-search v-model:value="loginLogFormQueryModel.keySearchVo" placeholder="关键字搜索" :disabled="loginLogFormQuerySubmitting" @search="loginLogFormQuerySearch" />
            </a-form-item>
          </a-col>
          <a-col :span="16">
            <a-button type="link" :style="{ ...coreStyle.floatRight }" @click="loginLogFormQueryUpDown">
              展开
              <CoreIcon icon="akar-icons:chevron-down" :size="14" />
            </a-button>
          </a-col>
        </a-row>
        <a-row :gutter="16" v-show="loginLogFormQueryVisible">
          <a-col :span="8">
            <a-form-item>
              <a-input-search v-model:value="loginLogFormQueryModel.keySearchVo" placeholder="关键字搜索" :disabled="loginLogFormQuerySubmitting" @search="loginLogFormQuerySearch" />
            </a-form-item>
          </a-col>
          <a-col :span="16">
          </a-col>
          <a-col :span="8">
            <a-form-item label="登录端">
              <a-input v-model:value="loginLogFormQueryModel.loginSideAndLike" placeholder="输入登录端" />
            </a-form-item>
          </a-col>
          <a-col :span="8">
            <a-form-item label="登录时间">
              <a-input-number v-model:value="loginLogFormQueryModel.loginTimes" :style="{ ...coreStyle.width('100%') }" />
            </a-form-item>
          </a-col>
          <a-col :span="8">
            <a-form-item label="账号Id">
              <a-input v-model:value="loginLogFormQueryModel.accountIdAndLike" placeholder="输入账号Id" />
            </a-form-item>
          </a-col>
          <a-col :span="8">
            <a-form-item label="账号">
              <a-input v-model:value="loginLogFormQueryModel.accountAndLike" placeholder="输入账号" />
            </a-form-item>
          </a-col>
          <a-col :span="8">
            <a-form-item label="用户名">
              <a-input v-model:value="loginLogFormQueryModel.usrnameAndLike" placeholder="输入用户名" />
            </a-form-item>
          </a-col>
          <a-col :span="8">
            <a-form-item label="手机号">
              <a-input v-model:value="loginLogFormQueryModel.mphoneNoAndLike" placeholder="输入手机号" />
            </a-form-item>
          </a-col>
          <a-col :span="8">
            <a-form-item label="邮箱">
              <a-input v-model:value="loginLogFormQueryModel.emailAndLike" placeholder="输入邮箱" />
            </a-form-item>
          </a-col>
          <a-col :span="8">
            <a-form-item label="关联类型">
              <a-input v-model:value="loginLogFormQueryModel.nexusTypeAndLike" placeholder="输入关联类型" />
            </a-form-item>
          </a-col>
          <a-col :span="8">
            <a-form-item label="对象Id">
              <a-input v-model:value="loginLogFormQueryModel.nexusObjectIdAndLike" placeholder="输入对象Id" />
            </a-form-item>
          </a-col>
          <a-col :span="24">
            <a-space :style="{ ...coreStyle.floatRight }">
              <a-button @click="loginLogFormQueryReset">
                <CoreIcon icon="ant-design:clear-outlined" :size="14" />
                重置
              </a-button>
              <a-button type="primary" ghost :loading="loginLogFormQuerySubmitting" @click="loginLogFormQuerySearch">
                <CoreIcon icon="ant-design:search-outlined" :size="14" />
                查询
              </a-button>
              <a-button type="link" @click="loginLogFormQueryUpDown">
                收起
                <CoreIcon icon="akar-icons:chevron-up" :size="14" />
              </a-button>
            </a-space>
          </a-col>
        </a-row>
      </a-form>
      <a-space>
        <!-- <a-button type="primary" ghost @click="loginLogAdd">
          <CoreIcon icon="carbon:add-alt" :size="14" />
          新增
        </a-button> -->
        <!-- <a-button type="dashed" @click="loginLogUpdate" v-if="loginLogListSelectLength === 1">
          <CoreIcon icon="ri:brush-line" :size="14" />
          修改
        </a-button> -->
        <a-popconfirm title="确认删除？" placement="bottom" :disabled="loginLogDeleteDisabled" @confirm="loginLogDelete">
          <a-button type="dashed" :disabled="loginLogDeleteDisabled" danger>
            <CoreIcon icon="jam:delete" :size="14" />
            删除
          </a-button>
        </a-popconfirm>
        <!-- <a-button @click="loginLogDetailInfo" v-if="loginLogListSelectLength === 1">
          <CoreIcon icon="heroicons-outline:light-bulb" :size="14" />
          详情
        </a-button> -->
      </a-space>
      <a-space :style="{ ...coreStyle.floatRight }">
        <a-button type="link" shape="circle" @click="loginLogListGetDataSet">
          <CoreIcon icon="ci:refresh" :size="22" />
        </a-button>
      </a-space>
      <a-table
        rowKey="id"
        :columns="loginLogListColumns"
        :data-source="loginLogListDataSet"
        :loading="loginLogListLoading"
        :pagination="false"
        bordered
        :customRow="loginLogListCustomRow"
        :row-selection="{ fixed: true, selectedRowKeys: loginLogListSelectedRowKeys, onChange: loginLogListRowOnChange }"
        :scroll="{ x: '100%', y: 550 }"
        :style="{ ...coreStyle.marginTop(10) }"
      >
        <template #loginSideData="{ text }">
          <span>{{ coreToolStore.getDictDisplayName('loginSide', text) }}</span>
        </template>
        <template #loginTimesData="{ text }">
          <span>{{ new Date(text).format() }}</span>
        </template>
      </a-table>
      <a-pagination
        v-model:current="loginLogListDataPage"
        v-model:pageSize="loginLogListDataRows"
        :total="loginLogListDataCount"
        show-size-changer
        show-quick-jumper
        :page-size-options="[ ...coreStyle.antdPaginationPageSizeOptions ]"
        :show-total="(total, range) => coreStyle.antdPaginationShowTotal(total, range)"
        :style="{ ...coreStyle.marginTop(10), ...coreStyle.textAlignCenter }"
        @change="loginLogListPaginationChange"
        @showSizeChange="loginLogListPaginationShowSizeChange"
        v-if="loginLogListPaginationVisible"
      >
      </a-pagination>
      <p :style="{ ...coreStyle.marginTop(14), ...coreStyle.marginBottom(6), ...coreStyle.textAlignCenter }" v-if="!loginLogListPaginationVisible">
        {{ coreStyle.antdPaginationShowTotal(loginLogListDataCount) }}
      </p>
    </a-card>
    <a-drawer
      v-model:visible="loginLogEditDrawerVisible"
      title="编辑登录日志信息"
      placement="right"
      :closable="false"
      :width="'40%'"
      :header-style="{ ...coreStyle.antdDrawerHeader }"
      :body-style="{ ...coreStyle.margin(50, 0, 30, 0) }"
      @close="loginLogEditDrawerOnClose"
    >
      <a-form ref="loginLogFormRef" :model="loginLogFormModel" :rules="loginLogFormRules" labelAlign="left" layout="vertical">
        <a-row :gutter="16">
          <a-col :span="12">
            <a-form-item label="登录端" name="loginSide">
              <a-input v-model:value="loginLogFormModel.loginSide" placeholder="输入登录端" />
            </a-form-item>
          </a-col>
          <a-col :span="12">
            <a-form-item label="登录时间" name="loginTimes">
              <a-input-number v-model:value="loginLogFormModel.loginTimes" :style="{ ...coreStyle.width('100%') }" />
            </a-form-item>
          </a-col>
          <a-col :span="12">
            <a-form-item label="账号Id" name="accountId">
              <a-input v-model:value="loginLogFormModel.accountId" placeholder="输入账号Id" />
            </a-form-item>
          </a-col>
          <a-col :span="12">
            <a-form-item label="账号" name="account">
              <a-input v-model:value="loginLogFormModel.account" placeholder="输入账号" />
            </a-form-item>
          </a-col>
          <a-col :span="12">
            <a-form-item label="用户名" name="usrname">
              <a-input v-model:value="loginLogFormModel.usrname" placeholder="输入用户名" />
            </a-form-item>
          </a-col>
          <a-col :span="12">
            <a-form-item label="手机号" name="mphoneNo">
              <a-input v-model:value="loginLogFormModel.mphoneNo" placeholder="输入手机号" />
            </a-form-item>
          </a-col>
          <a-col :span="12">
            <a-form-item label="邮箱" name="email">
              <a-input v-model:value="loginLogFormModel.email" placeholder="输入邮箱" />
            </a-form-item>
          </a-col>
          <a-col :span="12">
            <a-form-item label="关联类型" name="nexusType">
              <a-input v-model:value="loginLogFormModel.nexusType" placeholder="输入关联类型" />
            </a-form-item>
          </a-col>
          <a-col :span="12">
            <a-form-item label="对象Id" name="nexusObjectId">
              <a-input v-model:value="loginLogFormModel.nexusObjectId" placeholder="输入对象Id" />
            </a-form-item>
          </a-col>
        </a-row>
      </a-form>
      <div :style="{ ...coreStyle.antdDrawerFooter }">
        <a-space>
          <a-button @click="loginLogFormReset">
            <CoreIcon icon="ant-design:clear-outlined" :size="14" />
            重置
          </a-button>
          <a-button type="primary" ghost :loading="loginLogFormSaveSubmitting" @click="loginLogFormNextAdd">
            <CoreIcon icon="tabler:player-track-next" :size="14" />
            继续录入
          </a-button>
          <a-button type="primary" ghost :loading="loginLogFormSaveSubmitting" @click="loginLogFormSave">
            <CoreIcon icon="ant-design:save-outlined" :size="14" />
            保存
          </a-button>
        </a-space>
      </div>
    </a-drawer>
    <a-drawer
      v-model:visible="loginLogDetailDrawerVisible"
      title="登录日志详细信息"
      placement="right"
      :closable="false"
      :width="'40%'"
      :header-style="{ ...coreStyle.antdDrawerHeader }"
      :body-style="{ ...coreStyle.margin(50, 0, 30, 0) }"
    >
      <a-space direction="vertical" :size="20" :style="{ ...coreStyle.width('100%') }">
        <a-descriptions title="基础信息" :column="3" bordered>
          <a-descriptions-item label="登录端" :span="1">{{ loginLogDetailModel.loginSide }}</a-descriptions-item>
          <a-descriptions-item label="登录时间" :span="1">{{ loginLogDetailModel.loginTimes }}</a-descriptions-item>
          <a-descriptions-item label="账号Id" :span="1">{{ loginLogDetailModel.accountId }}</a-descriptions-item>
          <a-descriptions-item label="账号" :span="1">{{ loginLogDetailModel.account }}</a-descriptions-item>
          <a-descriptions-item label="用户名" :span="1">{{ loginLogDetailModel.usrname }}</a-descriptions-item>
          <a-descriptions-item label="手机号" :span="1">{{ loginLogDetailModel.mphoneNo }}</a-descriptions-item>
          <a-descriptions-item label="邮箱" :span="1">{{ loginLogDetailModel.email }}</a-descriptions-item>
          <a-descriptions-item label="关联类型" :span="1">{{ loginLogDetailModel.nexusType }}</a-descriptions-item>
          <a-descriptions-item label="对象Id" :span="1">{{ loginLogDetailModel.nexusObjectId }}</a-descriptions-item>
        </a-descriptions>
      </a-space>
      <div :style="{ ...coreStyle.antdDrawerFooter }">
        <a-space>
          <a-button type="dashed" @click="loginLogDetailUpdate">
            <CoreIcon icon="ri:brush-line" :size="14" />
            修改
          </a-button>
        </a-space>
      </div>
    </a-drawer>
  </div>
</template>

<script lang="ts">
import { Options, Vue } from 'vue-class-component'
import { mapStores } from 'pinia'
import { useCoreToolStore } from '/@/store/modules/cn/core/tool/coreToolStore'
import type { Res } from '/@/tool/Res'
import type { Param } from '/@/tool/Param'

import { useLoginLogStore } from '/@/store/modules/cn/core/sign/loginLogStore'

import type { LoginLog } from '/@/model/cn/core/sign/eo/LoginLog'
import { toLoginLog } from '/@/model/cn/core/sign/eo/LoginLog'

import type { LoginLogQO } from '/@/model/cn/core/sign/qo/LoginLogQO'
import { toLoginLogQO } from '/@/model/cn/core/sign/qo/LoginLogQO'

import type { LoginLogVO } from '/@/model/cn/core/sign/vo/LoginLogVO'
import { toLoginLogVO } from '/@/model/cn/core/sign/vo/LoginLogVO'

@Options({
  name: 'CoreLoginLog',
  components: {
  },
  computed: {
    ...mapStores(useCoreToolStore, useLoginLogStore),
  },
})
export default class CoreLoginLog extends Vue {

  loginLogListDataSet: Array<LoginLogVO> = []

  loginLogListColumns: Array<object> = [
    {
      title: '登录端',
      dataIndex: 'loginSide',
      align: 'center',
      slots: { customRender: 'loginSideData' },
      // ellipsis: true,
      // width: 200,
    },
    {
      title: '登录时间',
      dataIndex: 'loginTimes',
      align: 'center',
      slots: { customRender: 'loginTimesData' },
      // ellipsis: true,
      // width: 200,
    },
    // {
    //   title: '账号Id',
    //   dataIndex: 'accountId',
    //   align: 'center',
    //   // ellipsis: true,
    //   // width: 200,
    // },
    {
      title: '账号',
      dataIndex: 'account',
      align: 'center',
      // ellipsis: true,
      // width: 200,
    },
    {
      title: '用户名',
      dataIndex: 'usrname',
      align: 'center',
      // ellipsis: true,
      // width: 200,
    },
    {
      title: '手机号',
      dataIndex: 'mphoneNo',
      align: 'center',
      // ellipsis: true,
      // width: 200,
    },
    // {
    //   title: '邮箱',
    //   dataIndex: 'email',
    //   align: 'center',
    //   // ellipsis: true,
    //   // width: 200,
    // },
    // {
    //   title: '关联类型',
    //   dataIndex: 'nexusType',
    //   align: 'center',
    //   // ellipsis: true,
    //   // width: 200,
    // },
    // {
    //   title: '对象Id',
    //   dataIndex: 'nexusObjectId',
    //   align: 'center',
    //   // ellipsis: true,
    //   // width: 200,
    // },
  ]

  loginLogListLoading: boolean = false

  loginLogListSelectedRowKeys: string[] = []

  loginLogListSelectData: Array<LoginLogVO> = []

  loginLogListSelectLength: number = 0

  loginLogListSelectCurrentRowIndex: number = -1

  loginLogListSelectCurrentRowData: LoginLogVO = toLoginLogVO()

  loginLogListPaginationVisible: boolean = true

  loginLogListDataPage: number = 1

  loginLogListDataRows: number = 10

  loginLogListDataCount: number = 0

  loginLogListRowOnChange(selectedRowKeys, selectedRows) {
    this.loginLogListSelectedRowKeys = [ ...selectedRowKeys ]
    this.loginLogListSelectData = [ ...selectedRows ]
    this.loginLogListSelectLength = selectedRows.length
  }

  loginLogListCustomRow(record, index) {
    return {
      'class': index === this.loginLogListSelectCurrentRowIndex ? 'ant-table-row-selected' : '',
      onClick: (event) => {
        this.loginLogListSelectCurrentRowIndex = index
        this.loginLogListSelectCurrentRowData = { ...record }
        let selectedRowKeys = [ ...this.loginLogListSelectedRowKeys ]
        let selectedRows = [ ...this.loginLogListSelectData ]
        if (selectedRowKeys.includes(record.id)) {
          this.loginLogListRowOnChange([ ...selectedRowKeys.filter(eo => { return eo !== record.id }) ], [ ...selectedRows.filter(eo => { return eo.id !== record.id }) ])
        } else {
          selectedRowKeys.push(record.id)
          selectedRows.push(record)
          this.loginLogListRowOnChange([ ...new Set(selectedRowKeys) ], [ ...new Set(selectedRows) ])
        }
      },
      // onDblclick: (event) => {
      //   this.loginLogStore.pkVo(this.$toParam<LoginLogQO>({ id: this.loginLogListSelectCurrentRowData.id } as LoginLogQO)).then((res: Res<LoginLogVO>) => {
      //     if (res.succ) {
      //       this.loginLogDetailModel = { ...res.data[0] }
      //       this.loginLogDetailDrawerVisible = true
      //     } else {
      //       this.$message.error(res.msg, 6)
      //     }
      //   })
      // },
    }
  }

  loginLogListGetDataSet() {
    this.loginLogListLoading = true
    this.loginLogListRowOnChange([], [])
    this.loginLogListSelectCurrentRowIndex = -1
    this.loginLogListSelectCurrentRowData = toLoginLogVO()
    this.loginLogStore.pagingVo(this.$toParam<LoginLogQO>({ loginTimesDesc: 'y' } as LoginLogQO, this.loginLogListDataPage, this.loginLogListDataRows)).then((res: Res<LoginLogVO>) => {
      if (res.succ) {
        this.loginLogListPaginationVisible = true
        this.loginLogListDataSet = [ ...res.data ]
        this.loginLogListDataCount = res.count
        setTimeout(() => { this.loginLogListLoading = false }, 500)
      } else {
        this.$message.error(res.msg, 6)
        setTimeout(() => { this.loginLogListLoading = false }, 500)
      }
    }).catch(err => {
      setTimeout(() => { this.loginLogListLoading = false }, 500)
    })
  }

  loginLogListPaginationChange() {
    this.loginLogListGetDataSet()
  }

  loginLogListPaginationShowSizeChange() {
    this.loginLogListGetDataSet()
  }

  loginLogFormQueryVisible: boolean = false

  loginLogFormQuerySubmitting: boolean = false

  loginLogFormQueryModel: LoginLogQO = toLoginLogQO()

  loginLogFormQueryUpDown() {
    this.loginLogFormQueryVisible = !this.loginLogFormQueryVisible
  }

  loginLogFormQueryReset() {
    if (this.$refs.loginLogFormQueryRef) {
      this.$refs.loginLogFormQueryRef.resetFields()
      this.loginLogFormQueryModel = toLoginLogQO()
    }
  }

  loginLogFormQuerySearch() {
    this.loginLogFormQuerySubmitting = true
    this.loginLogListLoading = true
    this.loginLogListRowOnChange([], [])
    this.loginLogListSelectCurrentRowIndex = -1
    this.loginLogListSelectCurrentRowData = toLoginLogVO()
    this.loginLogStore.queryVo(this.$toParam<LoginLogQO>(this.$toSearch({ ...this.loginLogFormQueryModel }))).then((res: Res<LoginLogVO>) => {
      if (res.succ) {
        this.loginLogListPaginationVisible = false
        this.loginLogListDataSet = [ ...res.data ]
        this.loginLogListDataCount = res.count
        setTimeout(() => { this.loginLogFormQuerySubmitting = false }, 5000)
        setTimeout(() => { this.loginLogListLoading = false }, 500)
      } else {
        this.$message.error(res.msg, 6)
        setTimeout(() => { this.loginLogFormQuerySubmitting = false }, 5000)
        setTimeout(() => { this.loginLogListLoading = false }, 500)
      }
    }).catch(err => {
      setTimeout(() => { this.loginLogFormQuerySubmitting = false }, 5000)
      setTimeout(() => { this.loginLogListLoading = false }, 500)
    })
  }

  loginLogEditDrawerVisible: boolean = false

  loginLogFormSaveSubmitting: boolean = false

  loginLogFormSaveContinue: boolean = false

  loginLogFormModel: LoginLog = toLoginLog()

  loginLogFormRules: object = {
    // loginSide: [
    //   { type: 'string', required: true, message: '登录端不能为空！', trigger: ['change', 'blur'] },
    // ],
    // loginTimes: [
    //   { type: 'number', required: true, message: '登录时间不能为空！', trigger: ['change', 'blur'] },
    // ],
    // accountId: [
    //   { type: 'string', required: true, message: '账号Id不能为空！', trigger: ['change', 'blur'] },
    // ],
    // account: [
    //   { type: 'string', required: true, message: '账号不能为空！', trigger: ['change', 'blur'] },
    // ],
    // usrname: [
    //   { type: 'string', required: true, message: '用户名不能为空！', trigger: ['change', 'blur'] },
    // ],
    // mphoneNo: [
    //   { type: 'string', required: true, message: '手机号不能为空！', trigger: ['change', 'blur'] },
    // ],
    // email: [
    //   { type: 'string', required: true, message: '邮箱不能为空！', trigger: ['change', 'blur'] },
    // ],
    // nexusType: [
    //   { type: 'string', required: true, message: '关联类型不能为空！', trigger: ['change', 'blur'] },
    // ],
    // nexusObjectId: [
    //   { type: 'string', required: true, message: '对象Id不能为空！', trigger: ['change', 'blur'] },
    // ],
  }

  loginLogFormReset() {
    if (this.$refs.loginLogFormRef) {
      this.$refs.loginLogFormRef.resetFields()
      this.loginLogFormModel = toLoginLog()
    }
  }

  loginLogFormSubmit() {
    this.loginLogFormSaveSubmitting = true
    this.$refs.loginLogFormRef.validate().then(() => {
      if (this.loginLogFormModel.id) {
        this.loginLogStore.update(this.$toParam<LoginLog>(this.loginLogFormModel)).then((res: Res<LoginLog>) => {
          if (res.succ) {
            this.$message.success(res.msg, 3)
            this.loginLogFormReset()
            this.loginLogFormSaveSubmitting = false
            if (!this.loginLogFormSaveContinue) {
              this.loginLogEditDrawerVisible = false
              this.loginLogListGetDataSet()
            }
          } else {
            this.$message.error(res.msg, 6)
            setTimeout(() => { this.loginLogFormSaveSubmitting = false }, 3000)
          }
        }).catch(err => {
          setTimeout(() => { this.loginLogFormSaveSubmitting = false }, 3000)
        })
      } else {
        this.loginLogStore.save(this.$toParam<LoginLog>(this.loginLogFormModel)).then((res: Res<LoginLog>) => {
          if (res.succ) {
            this.$message.success(res.msg, 3)
            this.loginLogFormReset()
            this.loginLogFormSaveSubmitting = false
            if (!this.loginLogFormSaveContinue) {
              this.loginLogEditDrawerVisible = false
              this.loginLogListGetDataSet()
            }
          } else {
            this.$message.error(res.msg, 6)
            setTimeout(() => { this.loginLogFormSaveSubmitting = false }, 3000)
          }
        }).catch(err => {
          setTimeout(() => { this.loginLogFormSaveSubmitting = false }, 3000)
        })
      }
    }).catch(() => {
      setTimeout(() => { this.loginLogFormSaveSubmitting = false }, 3000)
    })
  }

  loginLogFormSave() {
    this.loginLogFormSaveContinue = false
    this.loginLogFormSubmit()
  }

  loginLogFormNextAdd() {
    this.loginLogFormSaveContinue = true
    this.loginLogFormSubmit()
  }

  loginLogAdd() {
    if (this.loginLogFormModel.id) {
      this.loginLogFormReset()
    }
    this.loginLogEditDrawerVisible = true
  }

  loginLogUpdate() {
    this.loginLogStore.pk(this.$toParam<LoginLogQO>({ id: this.loginLogListSelectData[0].id } as LoginLogQO)).then((res: Res<LoginLog>) => {
      if (res.succ) {
        this.loginLogFormReset()
        this.loginLogFormModel = { ...res.data[0] }
        this.loginLogEditDrawerVisible = true
      } else {
        this.$message.error(res.msg, 6)
      }
    })
  }

  loginLogEditDrawerOnClose() {
    if (this.loginLogFormSaveContinue) {
      this.loginLogFormSaveContinue = false
      this.loginLogListGetDataSet()
    }
  }

  loginLogDelete() {
    let param: Array<LoginLog> = []
    this.loginLogListSelectData.forEach((eo: LoginLogVO) => {
      param.push({ id: eo.id } as LoginLog)
    })
    this.loginLogStore.removeBatch(this.$toParam<LoginLog>(param)).then((res: Res<LoginLog>) => {
      if (res.succ) {
        this.$message.success(res.msg, 3)
        this.loginLogListGetDataSet()
      } else {
        this.$message.error(res.msg, 6)
      }
    })
  }

  get loginLogDeleteDisabled() {
    return this.loginLogListSelectLength > 0 ? false : true
  }

  loginLogDetailDrawerVisible: boolean = false

  loginLogDetailModel: LoginLogVO = toLoginLogVO()

  loginLogDetailInfo() {
    this.loginLogStore.pkVo(this.$toParam<LoginLogQO>({ id: this.loginLogListSelectData[0].id } as LoginLogQO)).then((res: Res<LoginLogVO>) => {
      if (res.succ) {
        this.loginLogDetailModel = { ...res.data[0] }
        this.loginLogDetailDrawerVisible = true
      } else {
        this.$message.error(res.msg, 6)
      }
    })
  }

  loginLogDetailUpdate() {
    this.loginLogStore.pk(this.$toParam<LoginLogQO>({ id: this.loginLogDetailModel.id } as LoginLogQO)).then((res: Res<LoginLog>) => {
      if (res.succ) {
        this.loginLogFormReset()
        this.loginLogFormModel = { ...res.data[0] }
        this.loginLogDetailDrawerVisible = false
        this.loginLogEditDrawerVisible = true
      } else {
        this.$message.error(res.msg, 6)
      }
    })
  }

  mounted() {
    this.loginLogListGetDataSet()
  }

}
</script>

<style scoped lang="less">

</style>
